package com.qf.blog.controller;

import com.qf.blog.commons.utils.Result;
import com.qf.blog.dto.IndexDiscussPostDto;
import com.qf.blog.entity.DiscussPost;
import com.qf.blog.entity.User;
import com.qf.blog.service.DiscussPostService;
import com.qf.blog.vo.DiscussPostVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

/**
 * User: key
 * ClassName:DiscussController
 * Date: 2023/6/7
 * Time: 19:22
 * description:
 */
@Controller
@RequestMapping("/discuss")
public class DiscussController {

    @Autowired
    private DiscussPostService discussPostService;

    @RequestMapping("/publish")
    @ResponseBody
    public Result publish(@RequestBody DiscussPostVo discussPostVo){
        Integer integer = discussPostService.publishDiscuss(discussPostVo);
        if(integer <= 0){
            return Result.error();
        }
        return Result.ok();
    }
}
